import ajax from './ajax'
import weaderAjax from './weaderAjax'

export const reqGetCode = (phone) => ajax('/sendCode', {phone})
export const reqGetCodeByUsername = (username) => ajax('/sendCode/getCodeByUsername', {username})

export const reqLogin = ({username, password}) => ajax('/user/login', {username, password})
export const reqRegister = ({username, password, phone, code}) => ajax('/user/register', {username, password, phone, code})
export const reqForget = ({username, password, code}) => ajax('/user/Forget', {username, password, code})
export const reqUpdatePassword = ({password, newPassword}) => ajax('/user/updatePassword', {password, newPassword})
export const reqUserUpdate = ({status, role, targetId}) => ajax('/user/update', {status, role, targetId})
export const reqUserInfo = () => ajax('/user/userinfo')
export const reqUserList = (current = 1, size = 10) => ajax('/user/userList')
export const reqLogout = () => ajax('/user/logout')

export const reqFileList = (current = 1, size = 10) => ajax('/file/list', {current, size})
export const reqAdminFileList = (current = 1, size = 10) => ajax('/file/adminList', {current, size})
export const reqFileAdd = (fileList) => ajax('/file/add', {fileList})
export const reqFileDelete = (filename) => ajax('/file/delete', {filename})
export const reqAdminFileDelete = (filename, username) => ajax('/file/adminDelete', {filename, username})
export const reqFileReName = (filename, newFilename) => ajax('/file/update', {filename, newFilename})

export const reqHttpList = (current = 1, size = 10) => ajax('/http/list', {current, size})
export const reqHttpListOne = (_id) => ajax('/http/listOne', {_id})
export const reqHttpDelete = (_id) => ajax('/http/Delete', {_id})
export const reqHttpUpdate = (postData) => ajax('/http/update', postData)
export const reqHttpAdd = (postData) => ajax('/http/add', postData)

export const reqWebSocketList = (current = 1, size = 10) => ajax('/webSocket/list', {current, size})
export const reqWebSocketListOne = (_id) => ajax('/webSocket/listOne', {_id})
export const reqWebSocketDelete = (_id) => ajax('/webSocket/Delete', {_id})
export const reqWebSocketUpdate = (postData) => ajax('/webSocket/update', postData)
export const reqWebSocketAdd = (postData) => ajax('/webSocket/add', postData)
export const reqWebSocketRefresh = (_id) => ajax('/webSocket/refresh', {_id})

export const reqSevenDayWeader = (parmary) => weaderAjax('/', parmary)

export const reqCitySearchById = (id) => ajax('/city/searchById', {id})
export const reqCitySearchByStr = (str) => ajax('/city/searchByStr', {str})

export const reqAddResume = (params) => ajax('/resume/add', params)
export const reqResumeDelete = (_id) => ajax('/resume/Delete', {_id})
export const reqResumeList = (current = 1, size = 10) => ajax('/resume/list', {current, size})
export const reqResumeListOne = (_id) => ajax('/resume/listOne', {_id})
export const reqResumeUpdate = (params) => ajax('/resume/update', params)


